<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>AngularJS 表单事件基础</title>
		<style>
			input,
			button {
				margin: 10px;
				padding: 10px;
				font-size: 18px;
				color: #dd4814;
				font-family: 'microsoft yahei', Arial, sans-serif;
			}
		</style>
	</head>

	<body>
		<div ng-app="" ng-controller="studentController">

			<input name="firstname" type="text" ng-model="firstName" value="test" required><br/>
			<input name="lastname" type="text" ng-model="lastName" required><br/>
			<input name="email" type="email" ng-model="email" required><br/>

			<!-- ng-click触发控制器方法 -->
			<button ng-click="reset()">点击这里重置表单数据</button>

		</div>

		<script src="http://cdn.gbtags.com/angular.js/1.2.20/angular.min.js"></script>
		<script>
			function studentController($scope) {

				//调用reset将表单输入框对应值设置为如下缺省值
				$scope.reset = function() {
					$scope.firstName = "terry";
					$scope.lastName = "lee";
					$scope.email = "terrylee@gbtags.com";
				}

				$scope.reset();
			}
		</script>
	</body>

</html>